<?php

function getCourseMembersByID($course_id = null, $roles)
{
    // if we're not passed a course id we can't proceed
    if($course_id == null){ return Array() ; }

    // if we're not passed a role we can't proceed
    if(count($roles) == 0){ return Array(); }

    $moodle_enrolled_people = array();

    // get the course context
    $context = get_context_instance(CONTEXT_COURSE, $course_id);

    // get the list of users who currently have this role
    foreach($roles as $role) {
	$users = get_role_users($role->id, $context);
        foreach($users as $user) {
	    $moodle_enrolled_people[$user->id] = $user;        
        }
    }

    return $moodle_enrolled_people ;
}

function distribution( $active_teachers_count )
{
	$distribution = array();
	foreach ( $active_teachers_count as $teacher )
	{
		$distribution[$teacher] += 1;
	}
	return $distribution;
}
?>
